﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{ 

    public class GridRowSettingsBuilder
    { 
        private readonly GridRowSettings row;
        public GridRowSettingsBuilder(GridRowSettings row)
        {
            this.row = row;
        }

        /// <summary>
        /// 设置 是否固定单元格(行)的高度
        /// </summary>
        public GridRowSettingsBuilder FixedCellHeight(bool value)
        {
            this.row.FixedCellHeight = value;
            return this;
        }

        /// <summary>
        /// 设置 是否允许反选行
        /// </summary>
        public GridRowSettingsBuilder AllowUnSelectRow(bool value)
        {
            this.row.AllowUnSelectRow = value;
            return this;
        }

        /// <summary>
        /// 设置 是否应有间隔行效果
        /// </summary>
        public GridRowSettingsBuilder AlternatingRow(bool value)
        {
            this.row.AlternatingRow = value;
            return this;
        }

        /// <summary>
        /// 设置 行经过时附加CSS类名
        /// </summary>
        public GridRowSettingsBuilder MouseoverRowCssClass(string value)
        {
            this.row.MouseoverRowCssClass = value;
            return this;
        }

        /// <summary>
        /// 设置 行自定义属性渲染器(包括style，也可以定义)
        /// </summary>
        public GridRowSettingsBuilder RowAttrRender(string functionName)
        {
            this.row.RowAttrRender = () => functionName;
            return this;
        }
        /// <summary>
        /// 设置 行自定义属性渲染器(包括style，也可以定义)
        /// </summary>
        public GridRowSettingsBuilder RowAttrRender(Func<string> function)
        {
            this.row.RowAttrRender = function;
            return this;
        }
    }
}
